package com.huang.core.widget.viewpager.adapter

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentPagerAdapter
import java.util.*

/**
 * Created by Android on 2018/8/17.
 */
class ViewPagerAdapter(fm: FragmentManager,
                       val mTitles: ArrayList<String>? = null,
                       val mFragments: ArrayList<Fragment>) : FragmentPagerAdapter(fm) {

    override fun getItem(position: Int): Fragment {
        return mFragments[position]
    }

    override fun getPageTitle(position: Int): CharSequence {
        if (mTitles == null) return ""
        return mTitles[position]
    }

    override fun getCount(): Int {
        return mFragments.size
    }
}